import {defineStore} from 'pinia'
import { ref } from 'vue'

export interface UserProfile{
	openid:string,
	token:string,
	nickName?:string,
	avatar?:string,
	province?:string,
	city?:string,
	server?:number,//所属服务器
	brand?:string,//品牌
	
}



export const useMemberStore = defineStore(
      'member',
	  ()=>{
		  const profile = ref<UserProfile>()
		  
		  const setProfile =(val:UserProfile)=>{
			  profile.value=val
		  }
		  
		  const clearProfile =()=>{
			  profile.value=undefined
		  }
		  
		  return{
			  profile,
			  setProfile,
			  clearProfile
		  }
	  },
	  {
		  persist:{
			  storage:{
				  getItem(key: string){
					return  uni.getStorageSync(key)
				  },
				  setItem(key: string,value: any) {
				  	 uni.setStorageSync(key,value)
				  }
			  }
		  }
	  }

)

